import cv2 as cv
import numpy as np

img = cv.imread('E://text.jpg')

# 缩放比例
scaleUp, scaleDown = 1.7, 0.5

scaleUWidth = round(img.shape[1]*scaleUp)
scaleUHeight = round(img.shape[0]*scaleUp)
scaleDWidth = round(img.shape[1]*scaleDown)
scaleDHeight = round(img.shape[0]*scaleDown)

# 进行图片处理
imgScaledU = cv.resize(img, (scaleUWidth, scaleUHeight), interpolation=cv.INTER_CUBIC)
imgScaledD = cv.resize(img, (scaleDWidth, scaleDHeight), interpolation=cv.INTER_AREA)
print(img.shape, imgScaledU.shape, imgScaledD.shape)

# 展示图片
cv.imshow("org", img)
cv.imshow("scaledU", imgScaledU)
cv.imshow("scaledD", imgScaledD)
cv.waitKey(0)

cv.destroyAllWindows()